//二分 贪心 肖恩的苹果园
//改进:枚举出在指定最小距离下，N个位置能种的最多的树M
//最小距离越大，能种的树越少，能种最少树M对应的最小距离就是最大值
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 1e5+9;
int n=0,m=0;
ll a[N];

//判断能不能种的下
bool check(ll mid)
{
	int loc = 2;
	int pre = 1;
	int tmp=m-1;
	while(tmp>0)
	{
		if(loc > n)
			return false;
		
		if(a[loc] - a[pre] < mid)
			loc++;
		else
		{
			pre = loc;
			loc++;
			tmp--;
		}
	}
	
	return true;
}
int main()
{
	cin >> n >> m;
	for(int i = 1;i <= n; i++)
		cin >> a[i];
	sort(a+1,a+1+n);
	ll l = 0;
	ll r = 1e9+9;
	while(l+1 != r)
	{
		ll mid = (l+r)/2;
		if(check(mid))
			l = mid;
		else r = mid;
	}
	cout << l;
	return 0;
}
